<?php

namespace Home\Model;
use Think\Model;
class GoodsModel extends Model {
    
    public function getByFilter($field,$where)
    {
        $filter=array_map(array($this->db,'escapeString'),I('get.'));
        $cid=$where['cid'];
        $order='gid desc';
        if(isset($filter['order']))
        {
            if($filter['order']=='price_asc')
               $order="price_asc";
            
            if($filter['order']=='price_desc')
               $order="price_desc";
        }
        
        $goodslist=$this->field($field)->where($where)->order($order)->select();
        return $goodslist;
    }
    
    
}